{template 'common/header'}
<ul class="nav nav-tabs">
    <li class="active"><a href="#">通知管理</a></li>
    <li class=""><a href="{php echo $this->createWebUrl("notifyset", array("id" => 0));}">新增通知</a></li>
</ul>
<div class="panel panel-info">
    <div class="panel-heading">筛选</div>
    <div class="panel-body">
        <form action="" method="post" class="form-horizontal" role="form">
            <input type="hidden" name="c" value="site" />
            <input type="hidden" name="a" value="entry" />
            <input type="hidden" name="m" value="q_3354988381_notify" />
            <input type="hidden" name="do" value="notify" />
            {if $_GET['id'] != ''}
            <input type="hidden" name="id" value="{$_GET['id']}" />
            {else}
            <input type="hidden" name="id" value="{$_GET['rid']}" />
            {/if}
              
            <div class="form-group">
                <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label" >openid</label>
                <div class="col-sm-8 col-lg-9">
                    <input class="form-control" name="openid" id="" type="text" value="{$_GPC['openid']}">
                </div>
                <div class=" col-xs-12 col-sm-2 col-lg-2">
                    <button class="btn btn-default"><i class="fa fa-search"></i> 搜索</button>
                </div>
            </div>
            <div class="form-group">
            </div>
        </form>
    </div>
  </div>
  
    <div style="padding:15px;">
        <table class="table table-hover">
            <thead class="navbar-inner">
                <tr>
                    <th>ID</th>
                    <th>调用者</th>
                    <th>openid</th>
                    <th>通知类型</th>
                    <th>通知内容</th>
                    <th>模板id</th>

					<th>状态</th>
                    <th>通知时间</th>
                    <th>操作</th>
                </tr>
            </thead>
  
            <tbody>
                {loop $list $row}
                <tr>
                    <td><small>{$row['id']}</small></small></td>
                    <td><small>{php echo $row['caller_name'] ? $row['caller_name'] : '未知'}</small></small></td>
                    <td><small>
                    {if $row['openid']}
                    	{$row['openid']}
                    {else}
                    	批量群发数
                    {/if}
                    </small></small></td>
                    <td><small>{php echo $row['type']=='T'?'模板通知':'客服消息';}</small></small></td>
                    <td><small>{$row['content']}</small></small></td>
                    <td><small>{$row['tpl_id']}</small></small></td>
                    
                    <td><small>
                    {if $row['openid']}
                    	{php echo $row['status']==1?'成功':'失败';}
                    {else}
                    	成功 {$row['son_succ']} / {$row['batch_count']}
                    {/if}                                      
                    </small></td>
                    <td><small>{php echo date('Y-m-d H:i:s', $row['create_at']);}</small></small></td>
                    <td>
                        <a href='{php echo $this->createWebUrl("notifyset", array("id" => $row[id]));}' title="编辑" class="btn btn-primary btn-sm">查看</a>
                        <a href="javascript:void(0);" onclick="delete_notify({$row['id']})" title="删除" class="btn btn-danger btn-sm">删除</a>
                    </td>
                </tr>
                {/loop}
            </tbody>
        </table>
        {$pager}
    </div>
    
	<script>
		//审核
	    function change_user_status(user_id, change_to){
	    	$.post(
	    			'{php echo $this->createWebUrl("UserStatusAjax")}',
	    	        {"user_id":user_id, "change_to":change_to},
	    	        function (data){
	    	        	location.reload();
	    	        }
	    	);
	    }
	    //删除
	    function delete_notify(notify_id){
	    	if(confirm('确定删除')){
		    	$.post(
		    			'{php echo $this->createWebUrl("DeleteNotifyAjax")}',
		    	        {"notify_id":notify_id},
		    	        function (data){
		    	        	location.reload();
		    	        }
		    	);
	    	}	
	    }
	</script>
{template 'common/footer'}